//
//  PopView.h
//  coverFlow
//
//  Created by warlee on 13-1-10.
//  Copyright (c) 2013年 warlee. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>

#define POP_ANIMATE_TIME        0.4
#define TAG_OFFSET_BACKGROUND   1112233440
#define TAG_OFFSET_POP_VIEW     1112233445
#define RGBA(R, G, B, A)        [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:A]
#define RGB(R,G,B)              [UIColor colorWithRed:R/255.0 green:G/255.0 blue:B/255.0 alpha:1.0]

typedef enum {
    PopViewAtLeft,
    PopViewAtRight,
    PopViewAtTop,    
    PopViewAtBottom,
    PopViewAtMiddle
}PopViewAt;

typedef enum {
    PopViewAnimationFromLeft,
    PopViewAnimationFromRight,
    PopViewAnimationFromTop,
    PopViewAnimationFromBottom,
    
    PopViewAnimationFromFadeIn,
    PopViewAnimationFromToBig,
    PopViewAnimationFromToSmall,
    PopViewAnimationFromFlip
}PopViewAnimationFrom;



@protocol PopViewDelegate;
@interface PopView : UIView<UIPageViewControllerDelegate>{
    int         popWidth;
    int         popHeight;
    BOOL        isRunning;      // 动画加载完成才可以关闭。
    CGRect      superViewFrame; //父视图frame
    UIView      * flipImageView;//flip动画原view
    UIView      * popMainView;  //添加到父视图的容器view；用于全部删除时，删除该容器
    UIView      * popMaskView;  //添加到父视图的半透明黑幕
}

@property id<PopViewDelegate> delegate;
@property CGRect                fromFrame;
@property CGRect                toFrame;
@property BOOL                  isbackground;
@property BOOL                  isBackgroundClick;
@property PopViewAt             popViewAt;
@property PopViewAnimationFrom  popViewAnimationFrom;
@property (strong, nonatomic)   UIView  * flipFromView;
@property (strong, nonatomic)   UIColor * backgroundColor;
@property (strong, nonatomic)   UIPanGestureRecognizer *gesture;
@property (nonatomic,strong)    IBOutlet UIView *thisView;

- (id)init;
- (void)setView;
- (void)closeAll;
- (void)closeView;
- (void)addView:(UIView *) theView;
@end


@protocol PopViewDelegate<NSObject>
@optional
-(void) PopViewDidClose;
@end

